// gui/GuiTextItem.h

#ifndef _GUI_GuiTextItem_H_
#define _GUI_GuiTextItem_H_

#ifndef _CORE_std_H_
#include <core/std.h>
#endif

#ifndef _GUI_GuiComponent_H_
#include "GuiComponent.h"
#endif

#ifndef _GFX_VisualText_H_
#include <gfx/VisualText.h>
#endif

namespace GUI
{

enum EGuiTextHAlign
{
	E_GUITEXTHALIGN_LEFT = 0,
	E_GUITEXTHALIGN_CENTRE,
	E_GUITEXTHALIGN_RIGHT,

	E_GUITEXTHALIGN_COUNT
};

enum EGuiTextVAlign
{
	E_GUITEXTVALIGN_TOP = 0,
	E_GUITEXTVALIGN_CENTRE,
	E_GUITEXTVALIGN_BOTTOM,
	E_GUITEXTVALIGN_BASELINE,

	E_GUITEXTVALIGN_COUNT
};

class GuiTextItem : public GuiComponent
{
public:

	GuiTextItem();

	virtual TypeId		GetTypeId() const {
		return s_TypeId;
	}
	static TypeId		GetStaticTypeId() {
		return s_TypeId;
	}

	// Accessors
	void				SetupGuiTextItem(wchar_t *pText, FONT::BMFont * pFont);

	void				SetText(wchar_t * pText) {
		m_VisualText.SetText(pText);
	}

	float				GetTextWidth() const {
		return m_VisualText.GetWidth();
	}
	float				GetTextHeight() const {
		return m_VisualText.GetHeight();
	}

	EGuiTextHAlign		GetHAlign() const;
	EGuiTextVAlign		GetVAlign() const;
	void				SetAlignment( EGuiTextHAlign eHAlign, EGuiTextVAlign eVAlign );

	void				SetColour( const CORE::Colour & colColour ) {
		m_VisualText.SetColour( colColour );
	}

	// APIs

	virtual void		Update( CORE::Time & TimeDelta ) {}

private:

	static TypeId		s_TypeId;

	GFX::VisualText		m_VisualText;
};

inline GuiTextItem::GuiTextItem()
{
	GetFrame().AttachFrame( &m_VisualText.GetFrame() );
}

}; // namespace GUI

#endif // _GUI_GuiTextItem_H_ 